package com.fit.beans;

import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Basic;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import javax.persistence.ManyToMany;

import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.tapestry5.beaneditor.NonVisual;


import com.fit.interfaces.BorrowI;
import com.fit.interfaces.CarI;
import com.fit.interfaces.ServiceI;
import com.fit.service.CarsI;




@Entity
public class CarBean implements CarI  {

	@Id
	@GeneratedValue
	@NonVisual
	private long id;
	@Basic
	private String modelName;
	@Basic
	private String companyName;

	@Temporal (TemporalType.DATE)
	private Date yearOfProduct;
	
	@Basic
	private double price;
	
	@Basic
	private String chassisNumber;
	
	@Basic
	private boolean serviceDone;
	
//	@ManyToMany(targetEntity = BorrowBean.class)
	@OneToMany (targetEntity = BorrowBean.class , mappedBy="car")
	private List<BorrowI> borrows = new LinkedList<BorrowI>();
	
	@OneToMany(targetEntity = ServiceBean.class,mappedBy="carService")
	private List<ServiceI> services = new LinkedList<ServiceI>();

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#getId()
	 */
	public long getId() {
		return id;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#setId(long)
	 */
	public void setId(long id) {
		this.id = id;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#getModelName()
	 */
	public String getModelName() {
		return modelName;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#setModelName(java.lang.String)
	 */
	public void setModelName(String modelName) {
		this.modelName = modelName;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#getCompanyName()
	 */
	public String getCompanyName() {
		return companyName;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#setCompanyName(java.lang.String)
	 */
	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#getYearOfProduct()
	 */
	public Date getYearOfProduct() {
		return yearOfProduct;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#setYearOfProduct(java.util.Date)
	 */
	public void setYearOfProduct(Date yearOfProduct) {
		this.yearOfProduct = yearOfProduct;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#getBorrows()
	 */
	public List<BorrowI> getBorrows() {
		return borrows;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.CarI#setBorrows(java.util.List)
	 */
	public void setBorrows(List<BorrowI> borrows) {
		this.borrows = borrows;
	}

	public List<ServiceI> getServices() {
		return services;
	}

	public void setServices(List<ServiceI> services) {
		this.services = services;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public String getChassisNumber() {
		return chassisNumber;
	}

	public void setChassisNumber(String chassisNumber) {
		this.chassisNumber = chassisNumber;
	}

	public void setServiceDone(boolean serviceDone) {
		this.serviceDone = serviceDone;
	}

	public boolean isServiceDone() {
		return serviceDone;
	}
	
	


	
	
}
